import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 项目信息信息 */
export interface Info {
          id: number; // 主键
          name?: string; // 项目名称
          description: string; // 描述
          status?: number; // 项目状态
          constructionUnitIds: string; // 施工单位编号数组
          remark: string; // 备注
  }

// 项目信息 API
export const InfoApi = {
  // 查询项目信息分页
  getInfoPage: async (params: any) => {
    return await request.get({ url: `/project/info/page`, params })
  },

  // 查询项目信息详情
  getInfo: async (id: number) => {
    return await request.get({ url: `/project/info/get?id=` + id })
  },

  // 新增项目信息
  createInfo: async (data: Info) => {
    return await request.post({ url: `/project/info/create`, data })
  },

  // 修改项目信息
  updateInfo: async (data: Info) => {
    return await request.put({ url: `/project/info/update`, data })
  },

  // 删除项目信息
  deleteInfo: async (id: number) => {
    return await request.delete({ url: `/project/info/delete?id=` + id })
  },

  /** 批量删除项目信息 */
  deleteInfoList: async (ids: number[]) => {
    return await request.delete({ url: `/project/info/delete-list?ids=${ids.join(',')}` })
  },

  // 导出项目信息 Excel
  exportInfo: async (params) => {
    return await request.download({ url: `/project/info/export-excel`, params })
  },
}